package com.yf.catcafe.mapper;

import com.yf.catcafe.pojo.dto.AddCafeDto;
import com.yf.catcafe.pojo.enity.Cafe;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CoffesMapper {

    @Select("select * from tb_cafe")
    List<Cafe> query();

    @Select("select * from tb_cafe where id=#{id}")
    Cafe getDetails(Long id);

    @Select("select * from tb_cafe where category=#{category}")
    List<Cafe> queryByCategory(String category);

    @Select("select * from tb_cafe where name=#{name}")
    List<Cafe> queryByName(String name);

    void add(AddCafeDto addCafeDto);

    @Select("select * from tb_cafe limit 2")
    List<Cafe> seckillCafe();

}
